#ifndef MPDCLIENT_H
#define MPDCLIENT_H

#include <QtCore/QString>
#include <QtCore/QObject>
#include <QtCore/QMap>
#include <mpd/status.h>

class MPDClient : public QObject
{
    Q_OBJECT

public:
    MPDClient();
    bool connection(QString address = "localhost", int port = 6600, int timeout = 5);
    ~MPDClient();
    bool next();
    bool prev();
    bool stop();
    bool play();
    bool pause();
    bool isPlaying(mpd_status *s = 0);
    bool isStoped(mpd_status *s = 0);
    int position(mpd_status *s = 0);
    int totalTime(mpd_status *s = 0);
    void freeStatus(mpd_status *s);
    bool checkConnection();
    bool playIndex(int index);
    QList<QMap<QString, QVariant> > getPlaylist();
    struct song;
    MPDClient::song currentSong();
    typedef mpd_status status;
    status* getStatus();

signals:
    void connectionBroken();
    void connected();

private:
    struct mpd_connection *conn;
    bool isConnected;
};

struct MPDClient::song
{
    QString title;
    QString artist;
    QString album;
    QString track;
    int duration;
};

#endif // MPDCLIENT_H
